package com.gthncz.hello.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/auth")
public class SecurityAuthController {

	private static final Logger log = LoggerFactory.getLogger(SecurityAuthController.class);
	
	@RequestMapping(value = {"/login"}, method = RequestMethod.GET)
	public String login(Model model) {
		return "login";
	}
	
	@RequestMapping(value = {"/form"}, method = RequestMethod.POST)
	@ResponseBody
	public String loginPost(HttpServletRequest request, HttpServletResponse response) {
		String refer = request.getHeader("refer");
		log.info("loginPost get refer: {}", refer);
		return "login OK";
	}
	
}
